<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>4</title>
    </head>
    <body>
        <div id="app">
            <div v-for="(i,index) in timearr">第{{index + 1}}个时间戳转换：{{i | timer}}</div>
        </div>
        <script src="../js/vue.js"></script>
        <script>
            var app = new Vue({
                el: "#app",
                data: {
                    timearr: [1579657789851, 1563516693000, 1578539380000]
                },
                filters: {
                    timer: function (value) {
                        let time = new Date(value);
                        let year = time.getFullYear();
                        let month = time.getMonth()+1;
                        let day = time.getDate();
                        let hours = time.getHours();
                        let minutes = time.getMinutes();
                        let seconds = time.getSeconds();
                        return year + "年" + month + "月" + day + "日" + " " + hours + ":" + minutes + ":" + seconds;
                    }
                }
            })
        </script>
    </body>
</html>